/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.googlecode.datawander.Presenter;

import com.googlecode.datawander.Settings.Preferences;
import com.googlecode.datawander.Settings.PreferencesException;
import com.googlecode.datawander.View.PreferenceControlerInt;
import com.googlecode.datawander.i18n.I18n;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import org.apache.log4j.Logger;



/**
 *
 * @author Marcin Stachniuk
 */
public class PreferenceControlerImpl implements PreferenceControlerInt {

    private static final Logger logger = Logger.getLogger(PreferenceControlerImpl.class);

    public void saveLanguage(I18n.LANGUAGE lang)
            throws PreferencesException  {
        logger.trace("saveLanguage("+lang+")");
        Preferences pref = new Preferences();
        pref.setLang(lang);
        pref.save();
    }

    public I18n.LANGUAGE getActualSevedLanguage() throws PreferencesException {
        logger.trace("getActualSevedLanguage()");
        Preferences pref = new Preferences();
        pref.load();
        logger.debug("Actual Saved Language: "+pref.getLang());
        return pref.getLang();
    }

}
